
package edu.webbapps.cormac_susilo.core;

import java.util.List;
import javax.persistence.RollbackException;



/**
 * Basic contract for containers of Products, Customers, etc
 * 
 * T is type of elements in container
 * K is type of id (primary key)
 * 
 * @author hajo
 */
public interface IDAO<T, K> {

    /**
     * Call from ServletContextListener to close EntityManagerFactory
     */
    public void destroy();
    
    public void add(T t) throws RollbackException;

    public void remove(K id) throws RollbackException;

    public void update(T t) throws RollbackException;

    public T find(K id);
    
    public List<T> getAll();
    
    public int getCount();
}
